package org.to_zero.springboot.security.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.to_zero.springboot.security.entity.Dept;
import org.to_zero.springboot.security.entity.vo.ResponseEntity;
import org.to_zero.springboot.security.service.DeptService;

@RestController
@RequestMapping("dept")
public class DeptController {
    @Autowired
    private DeptService deptService;

    @PreAuthorize("hasAuthority('dept:query')")
    @GetMapping("query")
    public ResponseEntity query(Dept dept) {
        return deptService.selectDeptSelective(dept);
    }
}
